import re
while True:
    try:
        s = input()
        t1, t2 = re.findall(".{2}:.{2}:.{2}", s)
        t1 = [int(t) for t in t1.split(':')]
        t2 = [int(t) for t in t2.split(':')]
        c = (t2[0] - t1[0]) * 3600 + (t2[1] - t1[1]) * 60 + (t2[2] - t1[2])
        print(c / 60.)
    except:
        if s == "-1":
            break
        print("error")
